<template>
	<view style=" padding: 30rpx;">
		<button @click="onSetTimeOut()" type="primary">单次计时器setTimeOut</button>
		<button @click="onSetTimeOut('qhl','011')" type="primary" plain="true">启动带参计时器</button>
		<button @click="onClearTimeOut()" type="warn">取单次定时器clearTimeOut</button>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			onSetTimeOut(){
				console.log("onSetTimeOut()");
				this.timer1 = setTimeout(()=>{
					console.log("onSetTimeOut() callback ");
					// ...
					console.log("onSetTimeOut() callback  end");
					
				},3000);
			},
			onSetTimeOut(username,pwd){
				console.log("onSetTimeOut()",username,pwd);
				setTimeout((x,y)=>{
					console.log("--------callback",username,pwd);
				},2000,username,pwd)
			},
			onClearTimeOut(){
				console.log("onClearTimeOut() 取消计时器");
				this.timer1 = null;
			}
		}
	}
	
</script>

<style>
 button{ 
	 margin: 20rpx; 
 } 
</style>
